package com.losdun.cms.service.impl;

import java.util.List;
import com.losdun.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.losdun.cms.mapper.CmsCategoryMapper;
import com.losdun.cms.domain.CmsCategory;
import com.losdun.cms.service.ICmsCategoryService;

/**
 * 栏目管理Service业务层处理
 * 
 * @author sword.ye
 * @date 2025-05-08
 */
@Service
public class CmsCategoryServiceImpl implements ICmsCategoryService 
{
    @Autowired
    private CmsCategoryMapper cmsCategoryMapper;

    /**
     * 查询栏目管理
     * 
     * @param id 栏目管理主键
     * @return 栏目管理
     */
    @Override
    public CmsCategory selectCmsCategoryById(Long id)
    {
        return cmsCategoryMapper.selectCmsCategoryById(id);
    }

    /**
     * 查询栏目管理列表
     * 
     * @param cmsCategory 栏目管理
     * @return 栏目管理
     */
    @Override
    public List<CmsCategory> selectCmsCategoryList(CmsCategory cmsCategory)
    {
        return cmsCategoryMapper.selectCmsCategoryList(cmsCategory);
    }

    /**
     * 新增栏目管理
     * 
     * @param cmsCategory 栏目管理
     * @return 结果
     */
    @Override
    public int insertCmsCategory(CmsCategory cmsCategory)
    {
        cmsCategory.setCreateTime(DateUtils.getNowDate());
        return cmsCategoryMapper.insertCmsCategory(cmsCategory);
    }

    /**
     * 修改栏目管理
     * 
     * @param cmsCategory 栏目管理
     * @return 结果
     */
    @Override
    public int updateCmsCategory(CmsCategory cmsCategory)
    {
        cmsCategory.setUpdateTime(DateUtils.getNowDate());
        return cmsCategoryMapper.updateCmsCategory(cmsCategory);
    }

    /**
     * 批量删除栏目管理
     * 
     * @param ids 需要删除的栏目管理主键
     * @return 结果
     */
    @Override
    public int deleteCmsCategoryByIds(Long[] ids)
    {
        return cmsCategoryMapper.deleteCmsCategoryByIds(ids);
    }

    /**
     * 删除栏目管理信息
     * 
     * @param id 栏目管理主键
     * @return 结果
     */
    @Override
    public int deleteCmsCategoryById(Long id)
    {
        return cmsCategoryMapper.deleteCmsCategoryById(id);
    }
}
